From: Jim Blandy Date: Sat, 20 Mar 1993 21:07:59 +0000 (+0000) Subject: * xterm.c (x_term_init): If the X connection is already in file X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96775 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=a4fc73600689c581d66df71f2fae14f97fe42649;p=emacs.git * xterm.c (x_term_init): If the X connection is already in file descriptor zero, don't dup it and close the old one. --- diff --git a/src/xterm.c b/src/xterm.c index 35bacb748cd..f766e129593 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4557,17 +4557,20 @@ x_term_init (display_name) x_watch_cut_buffer_cache (); #endif - dup2 (ConnectionNumber (x_current_display), 0); + if (ConnectionNumber (x_current_display) != 0) + { + dup2 (ConnectionNumber (x_current_display), 0); #ifndef SYSV_STREAMS - /* Streams somehow keeps track of which descriptor number - is being used to talk to X. So it is not safe to substitute - descriptor 0. But it is safe to make descriptor 0 a copy of it. */ - close (ConnectionNumber (x_current_display)); - ConnectionNumber (x_current_display) = 0; /* Looks a little strange? + /* Streams somehow keeps track of which descriptor number + is being used to talk to X. So it is not safe to substitute + descriptor 0. But it is safe to make descriptor 0 a copy of it. */ + close (ConnectionNumber (x_current_display)); + ConnectionNumber (x_current_display) = 0; /* Looks a little strange? * check the def of the macro; * it is a genuine lvalue */ #endif /* SYSV_STREAMS */ + } #endif /* ! defined (HAVE_X11) */